package nz.ac.massey.cs.domain;

import java.util.ArrayList;

import nz.ac.massey.cs.utils.CellType;


public class Cell {
	private String value;
	private int rowIdx;
	private int colIdx;
	private CellType type;
	private ArrayList<IConstraint> Constraints;
	private boolean writable;
	
	public boolean isWritable() {
		return writable;
	}

	private ArrayList<String> possibleValueList;
	
	
	public ArrayList<String> getPossibleValueList() {
		return possibleValueList;
	}

	public int getRowIdx() {
		return rowIdx;
	}

	public void setRowIdx(int rowIdx) {
		this.rowIdx = rowIdx;
	}

	public int getColIdx() {
		return colIdx;
	}

	public void setColIdx(int colIdx) {
		this.colIdx = colIdx;
	}

	public CellType getType() {
		return type;
	}

	public void setType(CellType type) {
		this.type = type;
	}
	
	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		if(writable)
		{
			this.value = value;
		}
	}
	
	public void addConstraint(IConstraint con)
	{
		this.Constraints.add(con);
	}
	
	public ArrayList<IConstraint> getConstraints() {
		return this.Constraints;
	}
	
	public boolean removePossibleValue(String value)
	{
		return possibleValueList.remove(value);
	}
	
	public Cell(boolean write,String value,ArrayList<String> valueRangeOfCell,int x,int y)
	{
		this.rowIdx = x;
		this.colIdx = y;
		this.writable = write;
		this.value = value;
		this.Constraints = new ArrayList<IConstraint>();
		this.possibleValueList = valueRangeOfCell;

	}

	
}
